'use client'; import './style.scss'; import '../../crew/widget/style.scss'; import { useState, useEffect, useCallback } from 'react'; import { useParams } from 'next/navigation'; import Link from 'next/link'; import { fetchApi } from '@/lib/utils/client'; import { useStudioContext } from '@/app/studio/context'; import type { CrewItem, CrewListResponse } from '@/types/response/crew/list'; import { Button } from '@/components/ui/button'; import CrewSettingsTab from './_components/CrewSettingsTab'; import CrewMembersTab from './_components/CrewMembersTab'; import CrewWidgetTab from './_components/CrewWidgetTab'; import CrewSessionTab from './_components/CrewSessionTab'; const TABS = [ { key: 'settings', label: '기본 설정' }, { key: 'members', label: '크루원' }, { key: 'widget', label: '위젯' }, { key: 'session', label: '세션' } ] as const; type TabKey = typeof TABS[number]['key']; export default function CrewDetailPage() { const { id } = useParams<{ id: string }>(); const { channelID } = useStudioContext(); const crewID = Number(id); const [crew, setCrew] = useState(null); const [loading, setLoading] = useState(true); const [activeTab, setActiveTab] = useState('members'); const fetchCrew = useCallback(async () => { if (!channelID) return; try { const res = await fetchApi(`/api/studio/crew/list/${channelID}`); const found = res.data?.list.find(c => c.id === crewID); if (found) setCrew(found); } catch {} }, [channelID, crewID]); useEffect(() => { setLoading(true); fetchCrew().finally(() => setLoading(false)); }, [fetchCrew]); if (loading) { return

준비 중...

; } if (!crew) { return

크루를 찾을 수 없습니다.

; } return (
{/* 헤더: 제목 + 액션 버튼 */}

{crew.name}

{crew.description &&

{crew.description}

}
{/* 탭 네비게이션 */} {/* 탭 컨텐츠 */}
{activeTab === 'settings' && } {activeTab === 'members' && } {activeTab === 'widget' && } {activeTab === 'session' && }
); }